Skip to main content

Data Injection

Data injection lets you embed dynamic values into any string field in a bot YAML. Instead of hardcoding text, you pull live data from the chat, bot state, CRM, messages, or current time.


Syntax

%provider:path%

Or with transformers (pipe functions):

%provider:path|transformer1(args)|transformer2(args)%

Parts

PartDescription
providerWhere the data comes from (chat, state, messages, time)
pathDot-notation path to the specific field
transformerOptional pipe function(s) to transform the value

Quick examples

Greet the customer by name

messages:
- "Hello %chat:title%, how can we help?"

Use a value collected earlier in the conversation

messages:
- "Nice to meet you, %state:node.ask_name.text%"

Format a phone number

value: '%chat:phone|formatPhone("smart","IL")%'

Use the current time

value: "%time:now%"

Chain multiple transformers

value: "%chat:resolvedUpdateTime|toString|parseInt%"

Multi-line with Handlebars template

value: |
%messages:latest(3,1,"any","text")|hbTpl("
{{#each .}}
[{{date timestamp}}] {{#when direction 'eq' 'incoming'}}{{provide 'chat' 'title'}}{{else}}{{agent}}{{/when}}:
{{text}}

{{/each}}
")%

Where can you use data injection?

Anywhere a string value appears in the YAML:

  • messages (prompt and notify)
  • params (function parameters — URLs, data payloads, query values)
  • choices titles
  • caption, subject, content
  • Inside webhook/request data and headers

Next steps